
function [autocorr] = expan_autocorr(func)

len = length(func);
autocorr(1) = (sum(func.*func))/len;
for i=2:len
    aux = [func((len-i+2):len); func(1:((len-i+2)-1))];
    % aux = [leg(i-1);]
    autocorr(i) = (sum(aux.* func))/len; 
end